package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Mobile   string `gorm:"type:varchar(30);not null;comment:'电话号码'"`
	Password string `gorm:"type:varchar(155);not null;comment:'密码'"`
}

func (u *User) UserFirstOrCreate(db *gorm.DB, mobile string) error {
	return db.Debug().Where("mobile=?", mobile).FirstOrCreate(u).Error
}
